home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / PowerLisp / PowerLisp 1.1.sea / PowerLisp 1.1 / PowerLisp Doc Viewer / PowerLisp Doc Viewer (.txt)
Encoding:
Common Ground  |  1994-04-04  |  97.1 KB  |  1,351 lines  |  [APPL/CGSL]

  1. &CGDC
  2. Garamond
  3. PowerLisp User Guide
  4. Palatino
  5.     PowerLisp
  6.     Helvetica
  7. #Common Lisp Development Environment
  8. Version 1.1
  9. by Roger Corman
  10. March 1, 1994
  11. Copyright 
  12.  1994 Roger Corman
  13. All rights reserved.
  14. Garamond
  15. PowerLisp User Guide
  16. Palatino
  17. Contents
  18. Introduction
  19. )$    Licensing
  20. Quick Start Tutorial
  21. Files in this Release
  22. Interactive Environment
  23. PowerEdit Text Editor
  24. PowerLisp Compiler
  25. PowerLisp Assembler
  26. PowerLisp Disassembler
  27. Linking and Debugging
  28. Memory Usage
  29. Operating System Issues
  30. PowerLisp History
  31. Common Lisp Implementation
  32. Non-standard Extensions
  33. Notes
  34. Garamond
  35. PowerLisp User Guide
  36. Palatino
  37. Introduction
  38. *GRPowerLisp 1.1 is the second public release of PowerLisp, a Common Lisp development
  39. Zenvironment for the Macintosh. It consists of a Common Lisp interpreter, native-code 680x0
  40. _compiler, 680x0 macro assembler, disassembler, incremental linker and multi-window text editor.
  41. bIt requires a Macintosh with at least a 68020 processor and system 7.0 or later. About 2 megabytes
  42. _of RAM are required to run it, and to do much with it you need more like 5 or 6 megabytes. Like
  43. 3any Common Lisp system, the more memory the better.
  44. ZPowerLisp has the ability to run in the background. While executing a Common Lisp program,
  45. Bthe user may switch to another application as it continues to run.
  46. 3&`ffg
  47. 0>331
  48. s0303
  49. 3"033#
  50. 30313
  51. 2f&`ffF&
  52. 2f`fFf
  53. PowerLisp is extremely fast.
  54. 9 All compiled PowerLisp functions execute as native 680x0
  55. ZHinstructions. The speed is comparable to other fully compiled languages.
  56. NPowerLisp programs execute in the background, while you are using the system. 
  57. All editor
  58. Z[functionality is fully available while you are compiling or otherwise executing Common Lisp
  59. ]programs. I do not know of another development environment on the Macintosh that can do this.
  60. POf course, you can also use a different application while your programs execute.
  61. Garamond
  62. PowerLisp User Guide
  63. Palatino
  64. ZaPowerLisp is being released as shareware. I expect to release regular updates, which will include
  65. Ynew features and bug fixes. The frequency and scope of these will depend on the amount of
  66. _interest there is in the product. I encourage everyone who finds this product useful to send me
  67. dthe shareware fee (see Licensing, below) and register your copy. Even if you don't elect to register
  68. ]it, I appreciate correspondence via e-mail or otherwise letting me know what you think of it.
  69. aThe documentation is currently sparse, because of my time constraints. I intend to produce better
  70. ]documentation in the near future. For now the general information below will have to suffice.
  71. aPlease check this product out. I believe it offers extraordinary value for the price. The primary
  72. \alternative for Lisp programming, Macintosh Common Lisp from Apple, is an excellent product.
  73. VPowerLisp cannot compete on features or performance with Macintosh Common Lisp. It is,
  74. ahowever, one tenth the cost ($50 as opposed to $500). I feel there may be a niche for a low-cost,
  75. %small, easy-to-use product like this.
  76. <I enjoy programming with PowerLisp, and I hope you will too.
  77. Roger Corman
  78. Garamond
  79. PowerLisp User Guide
  80. Palatino
  81. Z    Licensing
  82. *G`PowerLisp is distributed as shareware. I reserve the copyright to the executable application, as
  83. awell as the source code to the compiler, assembler and library functions. I am asking $50 for the
  84. aright to use one copy of PowerLisp. If you find this program useful, please send a check for this
  85. #amount to the address below (under 
  86. "Registering Your Copy of PowerLisp
  87. ). If you are a teacher,
  88. Z^and are interested in using this for a class, please contact me. I am prepared to offer a very
  89. Xreasonable licensing arrangement for classes. Unlicensed copies of this system cannot be
  90. /legitimately used in a class setting otherwise.
  91. ^I have spent a considerable amount of time developing this program. I may elect to spend a lot
  92. emore time on it, but only if licensing fees received warrant it. I do not expect a huge response to a
  93. aprogram of this type, but each license fee I do receive will have a definite impact on the amount
  94. "of time I will spend improving it.
  95. \You may share this program with others. You may not redistribute it for profit, nor make any
  96. 4changes to it, without the permission of the author.
  97. Garamond
  98. PowerLisp User Guide
  99. Palatino
  100. PowerLisp 1.0
  101. License Price:
  102.     $50.00 US
  103. What You Get:
  104. )$XOn receipt of your check, I will forward you any the most up-to-date information I have 
  105. Sregarding bugs, new versions and features. You may also receive a beta pre-release 
  106. version on floppy disk.
  107. )$YYou will receive at least one free major update by mail. I will send registered owners a 
  108. Ecopy of a new major revision before uploading it to on-line services.
  109. )$[If you send a list of requested additional features, I will do my best to implement them as
  110. :soon as possible. I will then forward you a courtesy copy.
  111. )$XI will attempt to help with any problems you have and answer questions. I can only offer
  112. Xlimited phone support. The preferred method of contacting me is via e-mail or US mail. I
  113. 8will answer all mail communications as soon as possible.
  114. )$VIf and when I decide to convert this to a commercial version (non-shareware) licensed 
  115. Uowners of the shareware version will be guaranteed a special arrangement. This would 
  116. Flikely be a free or at-cost license upgrade to the commercial version.
  117. Garamond
  118. PowerLisp User Guide
  119. Palatino
  120. Z"Registering Your Copy of PowerLisp
  121. Send a check for 
  122. $50.00
  123.  US to:
  124. Roger Corman
  125. 2124 Cummings Drive
  126. Santa Rosa, CA 95404
  127. *#^You may contact me by mail to the above address, or via e-mail or telephone (see below). Along
  128. Zwith the fee, be sure to send me your address (and phone number if you don
  129. t mind). Also I
  130. Wwould appreciate a mention of which version you have, what your system is like, and any
  131. Mcomments you have. A wish list of product improvements would also be welcome.
  132. America Online:
  133.     PowerLisp
  134. *$    Internet:
  135. PowerLisp@aol.com
  136. Telephone:
  137. '(707) 528-3321  (evenings and weekends)
  138. (707) 575-4024  (days)
  139. (707) 528-7477  (fax)
  140. Garamond
  141. PowerLisp User Guide
  142. Palatino
  143. Quick Start Tutorial
  144. *GUThis section is intended to briefly lead you through writing, running, compiling, and
  145. 9disassembling a small Common Lisp program with PowerLisp.
  146. )$8Start PowerLisp by double-clicking the application icon.
  147. UIt will take a few seconds as it loads the standard libraries. When it finishes, your
  148. Rworksheet will be displayed, with the blinking text cursor. The message 
  149. Ready for
  150. Linput
  151.  should appear in the status message area at the top of the worksheet.
  152. Turn on Lisp mode editing.
  153. XAlthough this is not the default text editing mode currently, you will typically want to
  154. Ouse it when editing Lisp programs. Text files whose extensions end with 
  155. .lisp
  156. :automatically default to this mode. To turn it on, select 
  157.  under the 
  158.  popup
  159. ~!menu at the top of the Worksheet.
  160. Enter a PowerLisp expression.
  161. Try typing:
  162. Monaco
  163. (list-all-packages)
  164. RThis command invokes the common lisp function which returns the packages loaded in
  165. %the system. To execute it, press the 
  166. Enter
  167.  key (not the 
  168. Return
  169.  key). In PowerLisp, the
  170. Return
  171. ) S key is only used for editing
  172. to enter a new line into the text in the window. Only
  173. Enter
  174. P key executes anything. In this case, the entire line of text that the cursor is
  175. ~;positioned on is read by the PowerLisp system and executed.
  176. Note that you may use 
  177. Return 
  178. )"*(hold down the Command key while pressing 
  179. Return
  180. ~Gto simulate the Enter key if you prefer. Some keyboards do not have an 
  181. Enter
  182.  key, and so
  183. may require this method.
  184. After pressing 
  185. Enter
  186. @ , the PowerLisp interpreter will output a list representing the
  187. ~Xpackages loaded in the system. All PowerLisp output is in bold-faced text. What you type
  188. is in normal text.
  189. Garamond
  190. PowerLisp User Guide
  191. Palatino
  192. )$*Create and execute a common lisp function.
  193. Try typing:
  194. Monaco
  195. (defun print-column (x)
  196. ,"Prints the elements of a list in a column."
  197. (dolist (i x)
  198. (print i)))
  199. ~$While typing this function, use the 
  200. Return
  201.  key to end each line.
  202. ~YAfter the whole function has been entered, highlight the entire expression by clicking to
  203. Xthe left of the opening parenthesis and dragging to the right of the ending parenthesis.
  204. AAfter the whole expression is highlighted (all four lines) press 
  205. Enter
  206.  . The Lisp system
  207. ~Qwill read and execute the expression, and then return and display the name of the
  208. defined function print-column.
  209. QAlternatively, since you are editing in Lisp mode, you may leave your text cursor
  210. [positioned immediately following the last close parenthesis if the function definition. You
  211. Nshould notice that the entire function definition is outlined. When you press 
  212. Enter
  213. , the
  214. ~Eoutlined expression is first automatically highlighted then executed.
  215. Execute the function.
  216. Type:
  217. ,(print-column '(see hear taste smell touch))
  218. print-column
  219. )T@ function you defined will cause the list elements to be printed
  220. ~Svertically in the worksheet (one element on each line). It is being executed by the
  221. interpreter.
  222. Get function documentation.
  223. Type:
  224. '(documentation 'print-column 'function)
  225. HThe system will display documentation that you defined for the function.
  226. Compile the function.
  227. Type:
  228. (compile 'print-column)
  229. ]If this is the first time you have requested the compiler, it will take a few seconds to load
  230. Vthe compiler and assembler. The time could take from five to twenty seconds, depending
  231. Won your machine. After loading the compiler, the system will compile the function. This
  232. should take a second or less.
  233. SIf the function compiles correctly, the system will print the name of the function.
  234. Garamond
  235. PowerLisp User Guide
  236. Palatino
  237. )$8Execute the compiled function by repeating step 4 above.
  238. \It is not necessary to retype this line
  239. just go to the previous line, highlight it and press
  240. Enter
  241. : . In PowerLisp, you should never have to retype anything!
  242. ~'The system should respond as in step 4.
  243. Disassemble the function.
  244. $Type and execute the following line:
  245. Monaco
  246. (disassemble 'print-column)
  247. VThe system will display a dump of the machine instructions which comprise the function
  248. print-column
  249. )T>. You may or may not be interested in this. Compiled PowerLisp
  250. ~Yfunctions always include code to check for the correct number of arguments (in this case,
  251. one).
  252. Time the function.
  253. GYou can invoke PowerLisp
  254. s high-resolution timer by executing the line:
  255. 3(time (print-column '(see hear taste smell touch)))
  256. XThe function will be executed as before, and will be followed by a message regarding the
  257. Uamount of time elapsed during execution. You may compare this against the interpreted
  258. Xversion by re-executing the function definition from step 3 and executing the line above
  259. Gagain. You will see that as an interpreted function it executes slower.
  260. )$#Save the function you have defined.
  261. Select the 
  262.  command from the 
  263.  menu. Name the new file 
  264. print
  265. column.lisp
  266. Select 
  267. PowerLisp Worksheet
  268.  from the 
  269. Window
  270. )') menu to return to the worksheet (or just
  271. ~Vclick on its window). Select the function definition (from step 3) by highlighting the
  272. whole thing.
  273. Execute the 
  274.  command via the 
  275.  menu or pressing 
  276. Select the file 
  277. print-column.lisp
  278.  from the 
  279. Window
  280.  menu or by clicking on its
  281. window.
  282. Execute the 
  283. Paste
  284.  command via the 
  285.  menu or pressing 
  286. ~3The function definition should be displayed in the 
  287. print-column.lisp
  288. window.
  289. Select 
  290.  from the 
  291.  menu to save the file.
  292. Garamond
  293. PowerLisp User Guide
  294. Palatino
  295. Important Notes
  296. )$WYou may have any number of files open. As editor memory gets filled up, temporary files
  297. Ymay be created to store copies of the files you are editing. The number of files you have
  298. Vopen does not affect the amount of memory available to Lisp programs (this is new with
  299. 8version 1.1). Actually, it has some affect but not much.
  300. )$#There is no difference between the 
  301. Monaco
  302. PowerLisp Worksheet
  303. and any other file.
  304. ~WEvery open file may act as a worksheet. Lisp output will, however, be inserted into any
  305. "file which you use as a worksheet.
  306. )$VIf you are not using Lisp mode editing, you may enter common lisp expressions either a
  307. line at a time, pressing 
  308. Enter
  309. : after each line, or by entering a complete expression and
  310. ~Wthen executing the entire thing at once. The latter is highly recommended. In the first
  311. Ycase, if you have not entered a complete Lisp expression (perhaps not closed a list), you
  312. Wwill see a prompt containing the number of open left parentheses in the message area at
  313. the top of the editor window.
  314. Garamond
  315. PowerLisp User Guide
  316. Palatino
  317. Files in this Release
  318. The application is called 
  319. Monaco
  320. PowerLisp 1.1
  321. ( Double click on it to launch PowerLisp.
  322. Z5The documentation is in a Microsoft Word format file 
  323. PowerLisp Documentation
  324. Z.folder in the PowerLisp main folder is called 
  325. Library
  326. )1&. It contains libraries that PowerLisp
  327. Z#needs while running. These include:
  328. cl.lisp
  329. +Portions of the PowerLisp standard library.
  330. assembler.lisp
  331. The PowerLisp assembler.
  332. compiler.lisp
  333. The PowerLisp 680x0 compiler.
  334. Z    loop.lisp
  335. ,The Common Lisp Loop facility (MIT version).
  336. backquote.lisp
  337. 6Optimized backquote facility (from CLTL2, Guy Steele).
  338. defpackage.lisp
  339. $The defpackage macro implementation.
  340. describe.lisp
  341.  A partial implementation of the 
  342. describe
  343.  function.
  344. format.lisp
  345. Format
  346.  function implementation.
  347. graphics.lisp
  348. 2Some basic graphics routines (PowerLisp specific).
  349. structures.lisp
  350.     Defstruct
  351.  macro implementation.
  352. Z_Additionally, compiled versions of these may exist along with these source files. They have the
  353. same name, with a 
  354. .fasl
  355. extension.
  356. Examples
  357. Hfolder contains some PowerLisp source files you may want to refer to for
  358. Z*examples of PowerLisp functions. The file 
  359. asm-funcs.lisp
  360.  gives some examples of using
  361. the assembler. The file 
  362. eliza.lisp
  363. )F3 is a rough version of the Eliza program from Peter
  364. ZUNorvig
  365. s book. The examples are admittedly sparse. I intend to have some good example
  366. _programs in future versions. If you have written an interesting program with PowerLisp, and you
  367. Lwouldn
  368. t mind having it distributed with the releases, please send it to me.
  369. PowerLisp Worksheet
  370. ;file is the file that normally gets loaded as the worksheet
  371. Z]when you launch PowerLisp. If you remove or delete this file, a new one will automatically be
  372. #created when you restart PowerLisp.
  373. Garamond
  374. PowerLisp User Guide
  375. Palatino
  376. Compiling the Libraries
  377. *%hPowerLisp 1.1 is distributed with pre-compiled versions of all its libraries, so compiling the libraries
  378. myourself should not be necessary. The following section is still useful, however, if you want or need to make
  379. #any changes to the library sources.
  380. aIf compiled version of the libraries were not included with your release, you will want to create
  381. Zthem yourself. Performance of compiled code is much better than interpreted code. Compiled
  382. Xlibraries may be left out of the release to reduce disk space (and modem transfer time).
  383. ^Compiling the included libraries takes a while. This is because the compiler is very slow when
  384. ?running in interpreted mode. Fortunately it can compile itself!
  385. A file 
  386. Monaco
  387. compile-libraries.lisp
  388.  is included in the 
  389. Examples
  390.  folder with this release.
  391. Z[Execute this file to compile the libraries. Give yourself as much memory as possible and be
  392. aprepared to wait a while. If you like you can switch to another application and let the libraries
  393. compile in the background.
  394. cThe assembler is compiled first, as this gives the best performance improvement. It starts out very
  395. dslow, but speeds up as it compiles. This is because each function, as it is compiled, is dynamically
  396. _linked into the run time environment, speeding future compilations. Likewise, the compiler will
  397. ^start to compile slowly and speed up. After the compiler is compiled, the other libraries will
  398. compile rapidly.
  399. =If compilation is successful, versions of the libraries with 
  400. .fasl 
  401. extensions should show up in
  402. your 
  403. Library
  404. sub-folder.
  405. ZbThe entire set of libraries will probably take from 10 to 70 minutes to compile, depending on your
  406. ]machine. Compiled PowerLisp files take up considerably more disk space than source files, but
  407. ^not necessarily more memory when loaded. This is because most of the data in the compiled file
  408. _is only used for load purposes (symbol references and loader information). The size of compiled
  409. Xlibraries is substantially reduced in version 1.1 (compared to 1.01) by eliminating much
  410. redundant symbol information.
  411. Garamond
  412. PowerLisp User Guide
  413. Palatino
  414. Interactive Environment
  415. *G^PowerLisp is integrated with the PowerEdit text editor. The environment provides a 
  416. worksheet
  417. Wapproach to Common Lisp development. It is specifically modeled on the MPW environment,
  418. Dand also resembled the approach used by the Mathematica application.
  419. VRather than having a window which emulates a console (e.g. the 
  420. Listener
  421.  in Macintosh
  422. SCommon Lisp), the worksheet approach does not emulate a console. Any number of text
  423. Wwindows may be open, and any Common Lisp code in any open window may be executed at any
  424. `time. The user typically enters a Common Lisp function or expression, highlights the expression,
  425. then presses the 
  426. Enter
  427.  key. Note that the 
  428. Enter
  429.  key is distinct from the 
  430. Return
  431.  key on the
  432. Macintosh keyboard. The 
  433. Return
  434. ) B key is used in the editor to insert a new line. It will not cause
  435. Z+the PowerLisp system to interpret any text.
  436. You may use 
  437. Return 
  438. )")(hold down the Command key while pressing
  439. Return) 
  440. )%Cto simulate the Enter key if you prefer. Some keyboards do not have
  441. Enter
  442. % key, and so may require this method.
  443. ZfFor convenience, if no text is highlighted, the entire line of text that the text cursor is on will be
  444. interpreted whenever the 
  445. Enter
  446. D key is pressed. This allows for a usage model which is similar to a
  447. Z!console (i.e. type a line, press 
  448. Enter
  449. , type another line, press 
  450. Enter
  451. !). Like most Lisp consoles, until
  452. Zba Lisp expression is completely entered, no evaluation takes place and no output is produced. If a
  453. XLisp expression is only partially completed, the message area will display the message 
  454. Monaco
  455. Ready
  456. Z    for input
  457.  followed by the number of open left parentheses. This indicates that you are in
  458. Z&the middle of executing an expression.
  459.     Pressing 
  460. Enter
  461. R after each line (partial expression input) should not be used when you are in the
  462. Z    editor
  463. , because 
  464. )*    Lisp mode
  465. )0; will sometimes cause more than just the current line to be
  466. Z    executed.
  467. ]After an entire Common Lisp expression is read, it is interpreted, and the resulting value is
  468. Moutput at the line immediately following the line that the text cursor is on.
  469. WSince Common Lisp code can be entered from anywhere in any window, a prompt is not very
  470. _useful. Output prompts also tend to get in the way of entering the next expression, as they can
  471. `inadvertently get sent back as part of the next expression. Therefore, by default, PowerLisp has
  472. Garamond
  473. PowerLisp User Guide
  474. Palatino
  475. Z=no prompt. You can set up a prompt by assigning the variable 
  476. Monaco
  477. *prompt*
  478.  to a function to
  479. ZNexecute. This function can output whatever prompt you want to standard output.
  480. WThe worksheet approach allows you to very easily edit, execute, re-edit, and re-execute
  481. `expressions without unnecessary typing. I think you will come to appreciate it as much as  I do.
  482. &The front-most edit window contains a 
  483. status line
  484. )/.. This area, under the popup menus, is used by
  485. Z7the system to display messages about what it is doing. 
  486. Unless the status line reads 
  487. Ready
  488. Z    for input
  489. , you should not attempt to execute a Common Lisp expression.
  490. ZUWhen a Common Lisp expression is being executed, you may execute editor commands, and
  491. _otherwise edit files. You may also switch to another application. In this case, the Common Lisp
  492. bprocessing will continue in the background. This is useful, for example, during a long compile. If
  493. Yyou attempt to edit a file (with PowerEdit, the PowerLisp editor), any text output by the
  494. ]Common Lisp program will be directed to what was the current text insertion point at the time
  495. cthe Enter key was pressed (to begin the execution). I think this is generally what you want. If you
  496. ]are editing the same file in which the expression was executed, however, the PowerLisp output
  497. ewill reset the insertion point whenever it outputs text. If you are going to edit files, you probably
  498. Mshould avoid editing the same file you are using to execute Common Lisp code.
  499. Garamond
  500. PowerLisp User Guide
  501. Palatino
  502. PowerEdit Text Editor
  503. *GcThe PowerEdit text editor does not use TextEdit (the built in text editor in the Macintosh ROM). It
  504. therefore is 
  505. [ restricted to text files of 32 kilobytes or less. In fact, it can easily handle text files
  506. ZZover a megabyte in size. Your memory partition size determines how many files can be open.
  507. ]PowerEdit does not need to keep the whole file in memory (any unmodified portions are left on
  508. `disk). However, the caching and memory usage are not currently as efficient as I would like. You
  509. 1may run out of memory if you open a lot of files.
  510. _PowerEdit, unlike TextEdit, correctly handles tabs. Tabs can be set to 1, 4 or 8 spaces for the
  511. Xdocument. Other tab settings can be added by using ResEdit to modify the Tabs popup menu
  512. eresource. Each text window gets its own tab setting. Tabs get saved in the resource fork of the file,
  513. Sso that when the file is reopened the editor will remember the most recent setting.
  514. _The PowerEdit functions should be self-explanatory. Features include Undo, Find, Replace, Copy,
  515. `Cut, Paste, Select All, and Print. The Print feature is currently pretty rough. It doesn
  516. t print
  517. ;anything except the text of the file (no fancy formatting).
  518. aThe Window menu maintains a list of all open text files. You can use it to navigate between files
  519. "when you have a lot of files open.
  520. *     Scrolling
  521. YPowerEdit uses an improved (slightly different) way of scrolling than most Macintosh text
  522. ceditors. While you drag the scrollbar thumb, the file scrolls. Normally, in other editors, the text
  523. `window does not scroll until after you release the thumb. I worked hard to get this scrolling to
  524. awork this way, and am very pleased with the result. The only downside I can see is that it may be
  525. ca bit sluggish on slower macs. I plan to have an option to revert to 
  526. normal
  527.  scrollbar behavior in
  528. a future version.
  529. Font and Size Pulldowns
  530. VEach text window may have a different font and character size associated with it. This
  531. ainformation is not currently saved with the file. The editor uses fractional widths internally to
  532. Zsupport non-monospaced font editing. Typically monospaced fonts work best for programming,
  533. however. The default font is 
  534. Monaco
  535. Monaco, 9 pt
  536. )H2. The font and font size selected are 
  537. remembered
  538. Z1by information in the resource fork of  the file.
  539. Garamond
  540. PowerLisp User Guide
  541. Palatino
  542. Document Preferences
  543. A resource of type 
  544. Monaco
  545. C is added to the resource fork of any text file which is created or
  546. Z\viewed by PowerEdit. It contains the user settings for the window position and size, the tab
  547. `setting, and the font and font size. It is compatible with the method that MPW uses to save this
  548. Minformation, so that it is convenient to alternate between PowerEdit and MPW.
  549. *2 Common Lisp Support in PowerEdit
  550. RPowerEdit includes some features which make it particularly useful for Common Lisp
  551. _programming. For one thing, all PowerLisp interpreter output (which is sent to standard output)
  552. ^is printed in a bold version of the font you have selected. There is no way to enter bold text
  553. aotherwise. This serves to distinguish between your input and the interpreter
  554. s output. The editor
  555. \stores and remembers text style information (while editing, not when the file is saved). The
  556. _PowerLisp system ignores this information, however. All text, bold or otherwise, looks the same
  557. to the interpreter.
  558. aAn additional Lisp support feature involves the highlighting of parenthesized expressions. If the
  559. dwindow is in Lisp Mode, and the text cursor is next to a parenthesized expression (a left or a right
  560. dparenthesis which is balanced) the entire expression is highlighted by an outline. This is difficult
  561. ^to explain but relatively easy to demonstrate. Just turn on Lisp Mode from the popup menu, and
  562. Benter a Common Lisp expression with several levels of parentheses.
  563. GLisp Mode is automatically turned on by the editor for any file with a 
  564. .lisp
  565. extension on the
  566. Z^filename. You can explicitly turn it on or off any time from the popup menu. You may find this
  567. \feature more annoying than useful. If so, turn it off. I will definitely make that an editor
  568. preference item.
  569. _Comments are no longer automatically italicized in Lisp Mode. I removed this feature because it
  570. Qdidn
  571. t work very well and tended to make the comments difficult to edit and read.
  572. ZWhile PowerEdit was designed to support editing with Common Lisp, it is not implemented in
  573. bCommon Lisp. It is written entirely in C++. While this limits the control over the editor that you
  574. ahave from Lisp, is allows the editor to be used in other products. I am considering releasing the
  575. Peditor as a stand-alone product. Let me know if you would be interested in this.
  576. Line Wrap Mode
  577.     Line Wrap
  578. )0S mode works better in 1.1 than it did in 1.01, but still has some bugs that show up
  579. Z_when editing text. It is also rather slow on certain machines. You may turn on this mode, via a
  580. `checkbox to the left of the status line. I find it occasionally useful to turn this mode on when
  581.     browsing 
  582. ).Gunformatted Lisp output (which may otherwise produce vary long lines). 
  583.     Line Wrap
  584. mode is not compatible with 
  585.     Lisp mode
  586. )0), so don
  587. t turn them on at the same time.
  588. Garamond
  589. PowerLisp User Guide
  590. Palatino
  591. Recent Enhancements
  592. aThe editor now uses its own heap, which is limited in size to 200k. A source file of about 80k is
  593. ilikely to fill it up. When the editor limit is reached, text is written to disk in a temporary file. As a
  594. ]result, you may edit many, large files without any effect on the space you have for your Lisp
  595. _programs. I find the occasional slowdown from disk activity is preferable to the way the editor
  596. `ate up memory in 1.01. Currently a temporary file for each open file is created, when the editor
  597. Oneeds memory. These files will be automatically deleted when the program exits.
  598. *$_The editor has been cleaned up internally, which seems to have eliminated some spurious crashes
  599. Qand data loss. I still recommend that you keep good backups of your source files.
  600. *$WLisp mode has been improved. As several of you noted, it seems logical that when a Lisp
  601. aexpression is outlined, pressing Enter should execute the entire expression, rather than just the
  602. `current line. I have implemented this. To make it obvious, the whole expression gets highlighted
  603. /for a fraction of a second before executing it.
  604. WAnother problem several people had was getting buried in open parentheses. When you are
  605. `entering expressions, and have not closed enough levels of parentheses, the system seems frozen.
  606. ]To make it clearer, the editor now shows the number of open parentheses in the message bar. I
  607. think this helps.
  608. aWhen you save a file which has bold or italicized text in it, the text attributes get stored in a
  609. fresource of the file. This causes the bold text to be bold when you later load the file (it saves this
  610. /attribute). You may use the edit menu commands 
  611. Italics
  612.  and 
  613. Plain 
  614. to control the text
  615. Z\attributes of text in a file. These attributes are entirely ignored by the Lisp interpreter.
  616. Editor Known Bugs
  617. ]Line Wrap mode and Lisp mode are not totally compatible. I avoid using them at the same time.
  618. cVertical bar text cursors may still get left on the screen from time to time. This is just a screen
  619. 7refresh issue
  620. it does not affect  the text in the file.
  621. Garamond
  622. PowerLisp User Guide
  623. Palatino
  624. PowerLisp Compiler
  625. *G]The PowerLisp compiler is a full 680x0 native code compiler. This means that a function, once
  626. ]compiled, executes as direct machine instructions. This allows the compiled lisp functions to
  627. \execute very fast. It is distinct from the intermediate code that some Lisp systems produce.
  628. ;The compiler can be invoked on a single function, with the 
  629. Monaco
  630. compile
  631.  function, or on a source
  632. file with the 
  633. compile-file
  634. )TA function. The first time you call either of these functions, the
  635. ZYcompiler and assembler modules are loaded into memory. This can take from 5 to 20 seconds
  636. adepending on your system. After loading, compiling is quick. A function typically takes less than
  637. one second to compile.
  638.     When the 
  639. compile-file
  640. )TG function is used, a binary file of machine code is produced. This file
  641. is of type 
  642. )*! and typically has the extension 
  643. .fasl
  644. # Binary files are typically about 3
  645. Zbtimes as large as the source files they originate from, but that is only because of the relatively
  646. dinefficient way that all the symbol information is stored in the binary file. PowerLisp 1.1 compiled
  647. afiles are about 40% smaller than 1.01 compiled files (and still compatible with 1.01 files). They
  648. `need to store a lot of symbol information so that all the addresses can automatically be updated
  649. bcorrectly when the file is loaded in another system or at a later date. Once loaded, compiled code
  650. \is relatively space efficient. When compiled code segments are no longer needed, the garbage
  651. &collector will correctly discard them.
  652. _The entire compiler is written in Common Lisp. A couple of support functions had to be added in
  653. eC++ because there is no support for packed arrays of short integers, but all the significant stuff is
  654. in the file 
  655. compiler.lisp
  656. )[C which is included in this release. The compiler directly generates
  657. Z_68000 assembler code, which it then passes off to the assembler to create the function. I could
  658. Ximprove the compiler performance somewhat by assembling as it goes, but I have found the
  659. 4intermediate step useful for debugging the compiler.
  660. aThe compiler generates code which generally behaves exactly like interpreted code, only faster. I
  661. Utypically see a 5 to 30 times speed improvement when I compile something. In terms of
  662. \debugging, there are some differences between interpreted and compiled code. In at least one
  663. `case, compiled code is more correct than interpreted (in the case of returning multiple values).
  664. ;Some special forms are not yet implemented in the compiler.
  665. Garamond
  666. PowerLisp User Guide
  667. Palatino
  668. PowerLisp 1.1 Modifications
  669. $The compiler now correctly compiles 
  670. Monaco
  671. 5 special forms, structures, and special declarations.
  672. labels
  673. )*: forms compile, but the generated code is the same as for 
  674. labels
  675. )*W works correctly when interpreted. Some bugs in the interpreter relating to these forms
  676. Z/and function closures were identified andfixed.
  677. ZThe compiler now behaves in accordance with CLTL2 concerning evaluation of compiled forms.
  678. -Forms are not evaluated in general, although 
  679.     eval-when
  680. )?# can be used to force evaluation at
  681. compile time.
  682. 6Compiled libraries now use the extension (by default) 
  683. .fasl
  684. )#  which is commonly used by other
  685. ZbLisp systems. Of course these files are not compatible with other Lisp systems. Compiled libraries
  686. Yare significantly smaller than 1.01 libraries. This is accomplished mostly by eliminating
  687. `redundancy in the symbol tables. This makes loading faster. Libraries are about 30% smaller, and
  688. ishould still be compatible with 1.01 libraries. That is, 1.01 libraries should still load into 1.1b1, but
  689. )1.1 libraries will not be usable by 1.01.
  690. [The 
  691. missing function
  692.  warning messages which so often were emitted by the compiler are now
  693. aeliminated. My hope is to add a better, more useful warning facility to replace this. In the mean
  694. btime it was more of a source of confusion and annoyance than a help. At any rate, if a function is
  695. Mmissing at run time, you will get an error message (the program won
  696. t crash).
  697. ^Tail recursion is now detected and eliminated by the PowerLisp 1.1 compiler. Expressions which
  698. \are written recursively but which end with a recursive call are compiled as though they were
  699. Mcoded as iterative expressions. This eliminates much unnecessary stack usage.
  700. Garamond
  701. PowerLisp User Guide
  702. Palatino
  703. PowerLisp Assembler
  704. *G_The assembler was designed primarily to service the compiler. It is, however, useful in its own
  705. dright. It could be used as a vehicle for accessing toolbox calls and other system services which are
  706. ]not otherwise provided. Little support for this is included, however, in the current release.
  707. [Not all 68000 instructions are implemented, although the most common ones are. The complete
  708. Csource to the assembler is included with this release, in the file 
  709. Monaco
  710. assembler.lisp
  711. . The
  712. Z]assembler is written in Common Lisp, and all assembler instructions are implemented as macros
  713. Yin the assembler package. These macros automatically expand into the machine code for the
  714. Yinstruction when expanded by the assembler in the appropriate context. This simple design
  715. ]allows the easy addition of assembler macros. Many sample macros can be seen in the assembler
  716. [source. 68000 instructions which are not implemented could be added by anyone who wanted to
  717. Stake the time. I plan to expand the assembler and add a foreign function interface.
  718. Garamond
  719. PowerLisp User Guide
  720. Palatino
  721. PowerLisp Disassembler
  722. Monaco
  723. disassemble
  724. )MG function can be used to disassemble a compiled function to examine its
  725. Z]machine code. It will disassemble functions which have been compiled by the Lisp compiler, as
  726. bwell as built-in functions which have been compiled by the C++ compiler. It isn
  727. t fancy, but it is
  728. ]pretty useful. For compiled Common Lisp functions, the disassembler is good at displaying the
  729. &names of called functions (targets of 
  730. 1 instructions). Compiled C++ functions often call
  731. Z\functions which the disassembler does not know about, so you may get some incorrect function
  732. Nnames. Normally you will only be disassembling compiled Common Lisp functions.
  733. Garamond
  734. PowerLisp User Guide
  735. Palatino
  736. Linking and Debugging
  737. *GZPowerLisp features an incremental linker which immediately link in functions when they are
  738. Zcompiled or loaded. Whenever a function is replaced by a new function, whether compiled or
  739. binterpreted, all compiled branches to that function are correctly routed to the new function. This
  740. ais done via a distributed jump table which is managed by the linker. Interpreted functions have a
  741. \jump table entry which will cause a branch into the interpreter whenever a compiled function
  742. ^tries to call them. The interpreter can then, based on call stack information, determine which
  743. dfunction was intended, and then evaluate it. If that function is later compiled, a direct jump to it
  744.  replaces the interpreter branch.
  745. _Debugging facilities are rudimentary. Some non-standard functions are included which will trace
  746. bthe evaluation call stack or the compiled function call stack. Unfortunately there is not a single
  747. *integrated function which will trace both.
  748. ]While a Common Lisp program is executing, the call stack may in fact have an interpreted lisp
  749. `function, which calls a compiled lisp function, which calls a compiled C++ function, which calls
  750. aan interpreted Lisp function, ad nauseam. This situation is quite common, in fact. Debugging is a
  751. Zlittle easier if all the functions you are debugging are compiled, or all are interpreted.
  752. [Trace and untrace functions are useful for interpreted code. They are not of much value for
  753. 0compiled code. I use the non-standard functions 
  754. Monaco
  755. address
  756.  and 
  757. exec-address
  758.  a lot to get
  759. Z.addresses which I can then examine in MacsBug.
  760. A function called 
  761. error-stack
  762. )M< is included with PowerLisp 1.1. If your program aborts with
  763. Z2an error message, you may immediately invoke this:
  764. (error-stack)
  765. `This will print a processor dump of the top ten stack frames when the error occurred. This works
  766. ]better for compiled-code than for interpreted code, because all the functionson the processor
  767. estack will be interpreter functions in interpreted mode (as opposed to your functions). It still will
  768. "print useful information, however.
  769. 7To see the interpreter stack, you may use the function 
  770. dump-lisp-stack
  771. . This must be
  772. ZZinvoked prior to an error occurring, however. Typically you can put it into the code of an
  773. ?interpreted function. When that function executes, the call to 
  774. dump-lisp-stack
  775.  will cause
  776. Zbthe top interpreter stack frames to get displayed, along with the associated lexical environments.
  777. Garamond
  778. PowerLisp User Guide
  779. Palatino
  780. Memory Usage
  781. *GaLike most Lisp systems, PowerLisp likes to have quite a bit of memory. Garbage collection will be
  782. Yinvoked frequently if you are short on memory, and that will cause performance to suffer.
  783. YAt startup, PowerLisp sets aside enough memory to hold the application
  784. s code segments in
  785. Xmemory, as well as some memory for operating system overhead such as windows, resources,
  786. `etc. Approximately 200k bytes of RAM are set aside for the editor to hold text. About 25% of the
  787. Wremaining memory is given to the stack. This allows a large amount of recursion without
  788. [overflowing the stack. The rest is allocated as a large non-relocatable block which is then
  789. (managed by the PowerLisp memory manager.
  790. ZThe PowerLisp memory manager allocates about 50% of the heap to Lisp nodes. These are each
  791. a10 bytes in size, and consist of two pointers and flag and type bits. They are used to store cons
  792. ecells, integers, floating point numbers, ratios, and characters. Other Lisp data types require larger
  793. _blocks. All larger items and variable sized memory blocks are allocated by the other 50% of the
  794. Xheap. This strategy has proven to provide good performance. Fixed size cons nodes can be
  795. callocated very quickly. The garbage collector only keeps track of these nodes, or objects which are
  796. referenced by these nodes.
  797. In a typical scenario:
  798. Monaco
  799. PowerLisp partition size:
  800. 4096K bytes (4 megabytes)
  801. System use:
  802.  600K
  803. Editor heap:
  804.  200K
  805. Stack:
  806.  900K
  807. Nodes:
  808. 1200K (around 125,000 nodes)
  809. Variable sized heap objects:
  810. 1200K (used by Lisp system)
  811. ZYVariable sized heap objects include compiled Lisp code, vectors, arrays, text editor data
  812. %structures, packages and hash tables.
  813. Garamond
  814. PowerLisp User Guide
  815. Palatino
  816. Memory Requirements
  817. XPowerLisp 1.1 requires at least a 2.5 megabyte partition. However, 3 megabytes is a more
  818. Zreasonable minimum. If you want to use the compiler, you will need at least a 3.5 megabyte
  819. bpartition. A larger partition is recommended, or else you will wait on the garbage collector a lot
  820. Bwhile compiling. 4 megabytes is a good size for moderate projects.
  821. New Features in PowerLisp 1.1
  822. WA major addition is the Memory window, which can be displayed via the Memory command in
  823. [the new Misc menu. It brings up a window which gives you animated displays of the PowerLisp
  824. [heaps, stacks and editor heap usage. It is useful for monitoring memory usage while you are
  825. Zrunning, and noticing how much time is spent in garbage collection. When you see the Nodes
  826. ;and Heap bars shrinking you know garbage is being recycled.
  827. Garamond
  828. PowerLisp User Guide
  829. Palatino
  830. Operating System Issues
  831. *GWPowerLisp runs only with Macintosh operating systems 7.0 or later. PowerLisp multitasks
  832. ^cooperatively with other applications, so that programs can continue running in the background
  833. Ywhile PowerLisp programs are executing. PowerLisp programs can also run in the background
  834. )while you are running other applications.
  835. `PowerLisp supports the standard four Apple Events: Launch, Open, Print and Quit. It is therefore
  836. \high-level event aware. It is 32-bit clean, and makes use of as much memory as you choose to
  837. give it.
  838. Garamond
  839. PowerLisp User Guide
  840. Palatino
  841. PowerLisp History
  842. *G^I have been working on this system, off and on, for the last six years. This has never been my
  843.  job. I work days as a software developer of graphic arts applications. The PowerLisp
  844. Xsystem has become a passion for me, in my off hours. I began it before I had ever used a
  845. ]Macintosh
  846. the first version ran on an IBM PC. It began as a highly portable C implementation,
  847. Zwhich included a subset of Common Lisp. I originally used it to debug my C programs, as an
  848. interactive scripting language.
  849. ]A couple years later, after my PC had been shelved and replaced with a Mac, I resurrected the
  850. [Lisp interpreter and ported it to the Macintosh. I translated it to C++, and redesigned the
  851. binterpreter to be fully object-oriented internally. I also figured out the right way to do garbage
  852. _collection. In overcoming the limitations of DOS 640k address space and garbage collection, the
  853. Xinterpreter development took off. I discovered I could easily implement most features of
  854. "Common Lisp in my C++ environment.
  855. bAs the interpreter developed, I needed a text editor. I use MPW most of the time, so I developed a
  856. Ytext editor, PowerEdit, which looks and acts similarly to MPW. I like the worksheet-based
  857. Xapproach to executing commands and scripts, and modeled the interaction of the user with
  858. ZPowerLisp on this style. In PowerLisp you can execute Common Lisp code from any window, by
  859. 'highlighting the text and pressing the 
  860. Enter
  861.  key, as in MPW.
  862. ZbAs I started to toy with the idea of actually creating a product, I decided that the system really
  863. aneeded a compiler for reasonable performance. I chose to build a native-code compiler entirely in
  864. YCommon Lisp. The source code to the compiler is included in this package. In building the
  865. bcompiler, I discovered and fixed a lot of problems in the system. Together with the compiler is an
  866. aassembler, which assembles a subset of 680x0 assembly instructions. It is used as the second pass
  867. [of the compiler, during code generation. Source code to the assembler is also included. All
  868. Uassembler instructions are implemented as Common Lisp macros, so it would be easy for
  869. =someone to extend the assembler to include more instructions.
  870. UAll the source code of PowerLisp was developed 100% by me (with the exception of the 
  871. Zafacility, a few of the library routines, and some of the example programs). I have not 
  872. borrowed
  873. Yor licensed any technology. This is somewhat a source of pride for me, though not exactly
  874. apractical. The editor is entirely my own, and does not use TextEdit, emacs, or anything else. The
  875. Ysource code is mostly MPW C++ and Common Lisp, with a couple small routines in assembler.
  876. 5The Common Lisp source is included with this release.
  877. Garamond
  878. PowerLisp User Guide
  879. Palatino
  880. Common Lisp Implementation
  881. *G[The Common Lisp implementation in this release of PowerLisp is lacking in a number of ways,
  882. ^which I will detail below. As you probably are aware, Common Lisp consists of a huge number of
  883. _functions and data types. Rather than wait a couple more years to release this, I have tried to
  884. binclude the most useful features of the language. As a very rough estimate, I believe this release
  885. Wimplements about 95% of Common Lisp as specified in the first edition of  Guy Steele
  886. Common
  887. Lisp: The Language
  888. 2nd edition.
  889.  If you don
  890. t count CLOS.
  891. ZZCLOS (the Common Lisp Object System) is a very important part of modern Common Lisp, and I
  892. *hope to add it to PowerLisp in the future.
  893. `I would like to build a reference of what is included, because it would include a huge number of
  894. _functions and features. Because of time constraints, however, I will have to base this document
  895. more on what is missing from 
  896. Common Lisp: The Language
  897. ". While a number of things are not
  898. Z8currently implemented, it is still a very useful system.
  899. \The following section of this document covers the PowerLisp language implementation, roughly
  900. 7in the order in which they are covered in Guy Steele
  901. Common Lisp: The Language
  902. , Second
  903. Edition.
  904. /In this document, I will refer to Guy Steele
  905. Common Lisp: The Language
  906. , the first edition, as
  907. CLTL1. 
  908. )$;The second edition of the reference will be referred to as 
  909. CLTL2
  910. Garamond
  911. PowerLisp User Guide
  912. Palatino
  913. Data Types
  914. Characters
  915. Symbols
  916. Lists
  917.     Functions
  918. Text strings
  919. Packages
  920. Hash tables
  921. Read tables
  922. MThese data types are all implemented according to the language specification.
  923. Numbers
  924. \Integers, floating-point and ratios are implemented. PowerLisp 1.1 includes  complex numbers
  925. band bignums (large integers). Integers are stored in 32 bits, floating-point in 64 bits and ratios
  926. bconsist of two integers. Only one size of floating point number is provided. Large integers may be
  927. 'any size up to your memory limitations.
  928. Arrays
  929. DGeneralized arrays, bit vectors and character strings are supported.
  930. ZBit vectors and generalized arrays may be multi-dimensional, up to 7 dimensions. Character
  931. 1strings may only be single-dimensioned (vectors).
  932. ]Arrays of specific types (packed arrays of integers, for example) are not supported, but this
  933. 6should largely be transparent to Common Lisp programs.
  934. Streams
  935. XStreams are implemented, but with few variables. All streams are currently input/output.
  936.     Pathnames
  937. UPathnames are just text strings currently
  938. system independent
  939.  path name object is
  940. `supported. Pathname strings can represent full path names, or partial path names relative to the
  941. ]default directory. They must be in Macintosh format, which uses colons rather than slashes to
  942. separate directory names.
  943. Examples of paths:
  944. Monaco
  945. ""VolumeName:My Directory:My File" 
  946. ; full path
  947. Z    "My File"
  948. ; in current directory
  949. ":My Subdirectory:My File"
  950. ; in subdirectory of current
  951. "::MyFile"
  952. $; in parent directory (one level up)
  953. Random States
  954. UThe random number package is fully implemented, including the random state data type.
  955. 5Random state objects not currently readable, however.
  956. Garamond
  957. PowerLisp User Guide
  958. Palatino
  959. Structures
  960. JStructures are implemented according to the language standard. Some of the
  961. ]options are not supported yet, however. List-based structures are not supported. In PowerLisp
  962. 61.1 code which uses structures will compile correctly.
  963. Objects
  964. dCLOS is not implemented in this version. I expect to add it in a future release. I consider it quite
  965. Nan important language extension, as most of my programming is object-oriented.
  966. Scope and Extent
  967. 3PowerLisp adheres to the Common Lisp specification.
  968. 0New to PowerLisp 1.1 is the correct handling of 
  969. Monaco
  970. special
  971.  declarations
  972. Z^by both the interpreter and compiler. Local variables which are declared special should now be
  973. ^handled correctly. In 1.01, only variables declared via defvar or defparameter were considered
  974. +special (plus some built-in variables like 
  975.     *package*
  976. Type Specifiers
  977. XThe Common Lisp type system conforms to CLTL2. No optimizations are currently done based
  978. on type declarations.
  979. Program Structure
  980. * aThis area of the language is more or less complete. This includes functions, both interpreted and
  981. bcompiled, special forms, macros (interpreted and compiled), special variables, constants, etc. All
  982. 'special forms are correctly recognized.
  983. All defining constructs (
  984. defun
  985. defmacro
  986.     defstruct
  987. defconstant
  988. , etc.) allow the
  989. Zdinclusion of a documentation string. This string gets stored on the property list of the symbol, and
  990. -can be accessed as specified by the language.
  991. [Compiled and interpreted functions can be freely intermixed in the call stack, and compiled
  992. Xfunctions are incrementally linked into the system as soon as they are compiled or read.
  993. \Defun and defmacro should now work correctly in non top-level contexts (this did not work in
  994. 1.01).
  995. Predicates
  996. Implemented.
  997. Garamond
  998. PowerLisp User Guide
  999. Palatino
  1000. Control Structure
  1001. SMost of this chapter is implemented, with a few exceptions. Compiler macros and the
  1002. Monaco
  1003. compiler-let
  1004. )TA form are not implemented. Some of the features which are new in 
  1005. CLTL2
  1006.   are
  1007. not implemented.
  1008. "It was pointed out to me that the 
  1009. > macro in 1.01 was incorrect. In particular, it did not update
  1010. Zcthe set of local variables 'in parallel' as it was supposed to do. This has been fixed in PowerLisp
  1011. 1.1. Also, implementations of 
  1012. psetq
  1013. )#< and all of the multiple value handling macros are included.
  1014. Declarations
  1015. ]Declarations are mostly allowed but ignored by PowerLisp. In future versions of the compiler,
  1016. \faster code generation should be possible by paying attention to declarations. Violations of
  1017. declarations are also ignored.
  1018. In PowerLisp 1.1, 
  1019. special
  1020.  declarations 
  1021. / significant, and are correctly interpreted and
  1022. Z    compiled.
  1023. Symbols
  1024. Implemented.
  1025. Packages
  1026. Implemented.
  1027. In PowerLisp 1.1, 
  1028. defpackage
  1029. )F9 and the remaining package functions and macros have been
  1030. ZZincluded. There may still be some problems with the way shadowing symbols are handled, and
  1031. \user interaction with the shadowing facility is not supported (load time querying to resolve
  1032. ambiguities).
  1033. Garamond
  1034. PowerLisp User Guide
  1035. Palatino
  1036. Numbers
  1037. ZPowerLisp 1.1 includes most of the numeric functionality specified in CLTL2. Specifically,
  1038. ^complex numbers have been added, large integers (unlimited size), and the trig functions. Some
  1039. \math functions will give an error when they encounter a large integer or complex number. The
  1040. Monaco
  1041. 5 manipulation functions are not implemented, nor the 
  1042. boole
  1043.  function.
  1044. ZQIntegers between 0 and 500 now are cached i.e. new ones never need to be created.
  1045. (eq 100 100)
  1046. (eq 501 501)
  1047. Characters
  1048. eAll chars are standard-chars. All characters are kept in a table, so never need to be created (as are
  1049. ^integers between 0 and 500). This makes some character handling more efficient. Some character
  1050. Z$related functions were added in 1.1.
  1051. *.    Sequences
  1052. bThese functions are pretty complete. All sequence operations can be applied to lists, vectors, bit
  1053. \vectors and character strings. A number of missing sequence functions are now implemented in
  1054. PowerLisp 1.1.
  1055. Lists
  1056. Implemented.
  1057. Hash Tables
  1058. CImplemented. Hash Tables are used internally by the package system.
  1059. Arrays
  1060. SPartially implemented. Arrays can be up to seven dimensions. Some key arguments to 
  1061. array
  1062. )#8 are not implemented. Packed arrays are not implemented.
  1063. Garamond
  1064. PowerLisp User Guide
  1065. Palatino
  1066. Strings
  1067. ]Mostly implemented. A few of these functions need to be implemented still. A number of string
  1068. @functions which were missing in 1.01 are now implemented in 1.1.
  1069. Structures
  1070. [Structures can be defined and are correctly added to the type system. Some key arguments to
  1071. Monaco
  1072.     defstruct
  1073. )?M and some slot options are not implemented yet. I intend to finish these as a
  1074. precursor to CLOS support.
  1075. In PowerLisp 1.1, the 
  1076. )`    defstruct
  1077. )?<  macro has been rewritten in Common Lisp. It is included in
  1078. the library 
  1079. structures.lisp
  1080. )i?. It the structure printing facility should now work correctly.
  1081. Z2Code which uses structures now compiles correctly.
  1082. The Evaluator
  1083. NThis is the Common Lisp interpreter. Top level run-time loop features such as 
  1084.  and 
  1085. Rare not implemented, as they are not really necessary in this type of environment.
  1086. Streams
  1087. cPartially implemented. This area is still a little weak and is a high priority for improvement. The
  1088. +most important features are there, however.
  1089. Input/Output
  1090. ^The Lisp reader is implemented as specified, which is not easy in an event-driven environment!
  1091. [Read macros can be defined, and are used internally for many things (check out the standard
  1092. "library and compiler source code).
  1093. Options to the 
  1094. format
  1095. )*B function are partially implemented. This needs some work still. A
  1096. ZKnumber of other features described in this chapter are not yet implemented.
  1097. aPowerLisp 1.1 has substantially improved upon PowerLisp 1.01 in this area. In particular, all the
  1098. Zoutput formatting variables are supported, circular lists can be read and written, and the
  1099. format
  1100. )*  function is much more complete.
  1101. Garamond
  1102. PowerLisp User Guide
  1103. Palatino
  1104. File System Interface
  1105. aAs mentioned above, pathnames are just character strings currently. I intend to change this soon,
  1106. &so that a pathname object contains an 
  1107. Monaco
  1108. FSSpec
  1109. )*0 internally but can still be specified by a path
  1110. ZCstring. Using strings for pathnames is compatible with Common Lisp.
  1111. 0Some macintosh-specific functions are available:
  1112. set-file-creator
  1113.  my-open-file "ROSA")
  1114. set-file-type
  1115.  my-open-file "EPSF")
  1116. ZaThese functions can be used to set the type and creator of any open file. An error is signaled if
  1117. :you try to call these functions on other types of streams.
  1118. /File wildcard specifiers are not yet supported.
  1119. Errors
  1120. 7Errors are implemented as exceptions (as thrown by the 
  1121. throw
  1122. )#" special form). They are typically
  1123. Z]caught at the top level. Continuable errors are not yet implemented (for want of a debugger).
  1124. _In general, all Lisp functions, both compiled and interpreted, signal errors whenever the wrong
  1125. .number or type of arguments is passed to them.
  1126. Miscellaneous Features
  1127. Compiler
  1128. .The compiler is covered in a separate section.
  1129. Documentation
  1130. 0The documentation facility is fully implemented.
  1131. Debugging tools
  1132. ZWhile compiled and interpreted functions peacefully coexist at run-time, their behavior as
  1133. -regards debugging is significant. The macros 
  1134. trace
  1135.  and 
  1136. untrace
  1137.   are implemented for
  1138. ZTinterpreted, but not compiled code. That is, you can compile a function which calls 
  1139. trace
  1140.  , but
  1141. Z<only the interpreted function calls will actually be traced.
  1142. S function is not implemented. There is no real interactive debugger. This should be
  1143. improved in a future release.
  1144. M macro is implemented, and uses the Mac
  1145. s Time Manager to produce microsecond
  1146. ZVtimings accurate to about 20 microseconds. This is very useful for performance tuning.
  1147. Garamond
  1148. PowerLisp User Guide
  1149. Palatino
  1150. Monaco
  1151. describe
  1152. )8Q function is only partially implemented (symbols are well supported). I intend to
  1153. improve it.
  1154. inspect
  1155. )1! function is not implemented yet.
  1156. S function can be used to determine how much memory is available. See below for more
  1157. Z1information about memory usage. Another function 
  1158. ' invokes the garbage collector. Usually
  1159. Z"you should call it before calling 
  1160.     Helvetica
  1161. to get an accurate result.
  1162. + function is implemented for editing files:
  1163.  filename)
  1164. Z-causes the PowerEdit editor to open the file 
  1165. filename
  1166. )0, for editing. This is identical to using the
  1167. Open command from the editor.
  1168. The functions 
  1169. dribble
  1170.  and 
  1171. apropos
  1172.  are not implemented.
  1173. Environmental Inquiries
  1174. These are not yet implemented.
  1175. _The complete Loop facility is provided courtesy of the publicly available source code from MIT.
  1176. ]This has been tested and run both in interpreted and compiled mode and seems to work fine. It
  1177. (has not been tested thoroughly, however.
  1178. ULoop macros tend to expand into huge Common Lisp expressions, which execute slowly in
  1179. ainterpreted mode but compile into pretty tight, fast code. It is like a language unto itself, and
  1180. rather interesting.
  1181. 'The first time the system encounters a 
  1182. 3 macro, it loads the loop package. This takes a few
  1183. seconds. Subsequent uses of 
  1184. ! will not demonstrate this delay.
  1185. Pretty Printing
  1186. Not implemented.
  1187. Not implemented (
  1188. CLTL2
  1189. J feature). If this product finds any kind of a market I will certainly add
  1190. ZKCLOS facilities in the future. I consider it the last remaining large task.
  1191. Garamond
  1192. PowerLisp User Guide
  1193. Palatino
  1194. Conditions
  1195. Not implemented (
  1196. CLTL2
  1197.  feature).
  1198. Series
  1199. Not implemented (
  1200. CLTL2
  1201.  feature).
  1202. Garamond
  1203. PowerLisp User Guide
  1204. Palatino
  1205. Non-standard Extensions
  1206. *G\Here are some non-standard functions and variables which are included in PowerLisp and which
  1207. you may find useful.
  1208. Monaco
  1209. *top-level*
  1210. variable
  1211. ZDThis should normally be bound to the top-level read-eval-print loop.
  1212. *prompt*
  1213. variable
  1214. Z_If bound and non-nil,  this variable should point to a function to execute during the read-eval
  1215. Z print loop after each iteration.
  1216. address
  1217. object
  1218. function
  1219. ZEReturns the machine address of  the lisp object that is its argument.
  1220. exec-address
  1221. compiled-function
  1222. [function]
  1223. Z^Returns the machine execution address of a compiled function. If a symbol which has a compiled
  1224. ZZfunction associated with it is passed, that symbol
  1225. s jump table address (maintained by the
  1226. bincremental linker) is returned. Note that this is different from the address of the function, but
  1227. ]normally just represents a jump instruction to the other address. This function is useful for
  1228. Fdebugging compiled code (in combination with a debugger like MacsBug).
  1229. function-definition
  1230.  function 
  1231. [function]
  1232. Z[Returns the lambda expression of an interpreted function. As Common Lisp does not specify a
  1233. cstandard way to retrieve the lambda expression of a function, this is a useful extension. Note that
  1234. @once a function is compiled, its lambda expression is discarded.
  1235. [function]
  1236. ZdExplicitly invokes the garbage collector. This is more or less a standard language extension, but is
  1237. 8not required by the standard. Use it before calling the 
  1238.  function for a more accurate
  1239. estimate of space remaining.
  1240. package-hash-table
  1241. package
  1242. function
  1243. ZLReturns the hash table used by the passed package. This is sometimes useful.
  1244. print-function
  1245. interpreted-function
  1246. function
  1247. Prints the passed function.
  1248. Garamond
  1249. PowerLisp User Guide
  1250. Monaco
  1251. Palatino
  1252. function
  1253. function
  1254. Z^Exits interpreter. You probably never want to call these. Just exit the program instead (using
  1255. menu Quit command).
  1256. hash-table-misses
  1257. hash-table
  1258. function
  1259. Z`Provides statistics on hash-table effectiveness. Returns the number of times a hash-table lookup
  1260. attempt has 
  1261. missed
  1262.  (failed).
  1263. hash-table-hits 
  1264. hash-table
  1265. function
  1266. Z`Provides statistics on hash-table effectiveness. Returns the number of times a hash-table lookup
  1267. attempt has 
  1268.  (succeeded).
  1269. set-file-type 
  1270. file-stream type-string
  1271. function
  1272. ZiSets the Finder type for the open file. Signals an error if a stream which is not a file is passed to it.
  1273. Example:
  1274. (setq f (open "myfile"))
  1275. set-file-type
  1276. )[+ f "EPSF") ; sets the file's type to 'EPSF'
  1277. set-file-creator
  1278. file-stream creator-string
  1279. function
  1280. ZhSets the Finder creator for the open file. Signals an error if a stream which is not a file is passed to
  1281. Example:
  1282. (setq f (open "myfile"))
  1283. set-file-creator
  1284.  f "ROSA")
  1285. )b"; set the file's creator to 'ROSA'
  1286. dump-lisp-stack
  1287. function
  1288. ZbThis function prints a trace of the evaluator stack. It will only include information on evaluated
  1289. (function calls (not compiled functions).
  1290. %stack-trace
  1291. function
  1292. Z^This function returns a list of information on each processor stack frame. This is useful when
  1293. `debugging compiled functions. Evaluated function calls will show up as calls to the interpreter.
  1294. *stack-trace*
  1295. variable
  1296. ZeAfter any error, this global variable is automatically left bound to a list of stack frames that were
  1297. `in effect at the time of the error (as obtained with %stack-trace). This is very useful. Use the
  1298. expression:
  1299. (error-stack)
  1300. &after an error to see the stack trace.
  1301. error-stack
  1302. function
  1303. ZaThis function may be used to print a dump of the processor stack state at the time the last error
  1304. Rwas encountered. This function can be used instead of the expression listed above.
  1305. Garamond
  1306. PowerLisp User Guide
  1307. Palatino
  1308. Notes
  1309. *O^I would like to thank my wife, Frances, for her assistance with this documentation and for her
  1310. patience and encouragement.
  1311. 3I would also like to thank Guy Steele, whose books 
  1312. Common Lisp: The Language, 
  1313. both editions,
  1314. Z]are a constant source of assistance and amusement (in the most positive sense). PowerLisp 1.1
  1315. ]also includes the optimized backquote facility from the second edition, as well as some other
  1316. functions from the book.
  1317. Peter Norvig's text 
  1318. )UHParadigms of Artificial Intelligence Programming: Case Studies in Common
  1319. Lisp 
  1320. Ntaught me a lot about the language and his many sample programs were useful in
  1321. ZWdebugging the interpreter and compiler. I highly recommend it to anyone learning Common
  1322. Lisp.
  1323. \Acknowledgements to MIT for their Loop facility source code, which I have included with this
  1324. package.
  1325. , (!    ?
  1326. C24EF
  1327. M+:.7I-
  1328. @<=L;*
  1329. p 0p`P
  1330. !%(+5
  1331.     )=',
  1332. xTPP`
  1333.  Hp    0
  1334. '#)$62
  1335.  @@H8H
  1336. xP(H`X
  1337. ( @$$
  1338. Nontrond #3    temp.0001
  1339. Roger Corman
  1340. Roger Corman
  1341. Microsoft Word
  1342. 'OFST
  1343. Chicago
  1344. Monaco
  1345. Palatino
  1346.     Helvetica:
  1347. Garamond
  1348. bPREC
  1349. nPRVS
  1350. zCAPN
  1351.